package com.bs.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.bs.entity.Employee;

import com.bs.mapper.EmployeeMapper;
import org.springframework.stereotype.Service;

@Service
public class EmployeeService extends ServiceImpl<EmployeeMapper, Employee> {
    public Boolean updatePwd(Integer id, String password, String rePassword) {
        if (password.equals(rePassword)) {
//            QueryWrapper<Employee> employeeQueryWrapper = new QueryWrapper<>();
//            employeeQueryWrapper.lambda().eq(Employee::getId,id)
            UpdateWrapper<Employee> employeeUpdateWrapper = new UpdateWrapper<>();
            employeeUpdateWrapper.lambda().set(Employee::getPassword,rePassword).eq(Employee::getId,id);
            return this.update(employeeUpdateWrapper);
        }else {
            return false;
        }
    }
}
